home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Internet Surfer: Getting Started
/
Internet Surfer - Getting Started (Wayzata Technology)(7231)(1995).bin
/
pc
/
mac
/
bonus
/
peter_le
/
dehqx-20
/
calccrc.a
< prev
next >
Wrap
Text File
|
1991-08-23
|
1KB
|
68 lines
; DeHQX v2.0.0 ⌐ Peter Lewis, Aug 1991
macro
PUSH
move.l &SYSLIST[1],-(sp)
endm
macro
POP
move.l (sp)+,&SYSLIST[1]
endm
regspc equ 16
rtsoff equ regspc+0
voff equ regspc+4
crcoff equ regspc+6
proc Main
export CalcCRC
; procedure CalcCRC(var crc:integer; v:integer);
; @crc @a0 = d0
; v d1
; @rts
CalcCRC
MOVEM.L A0/D0-D2,-(SP) ;Save all regs. except D0
move.l crcoff(sp),a0
move.w (a0),d0
move.w voff(sp),d1
move.w #7,d2
loop
lsl.b #1,d1
roxl.w #1,d0
bcc noxor
eor.w #$1021,d0
noxor
dbf d2,loop
move.w d0,(a0)
MOVEM.L (SP)+,A0/D0-D2
move.l (sp),6(sp)
add.l #6,sp
RTS
END
procedure CalcCRC (v: integer);
var
temp: boolean;
i: integer;
begin
for i := 1 to 8 do begin
temp := BAND(crc, $8000) <> 0;
crc := BOR(BSL(crc, 1), BSR(v, 7));
if temp then
crc := BXOR(crc, $1021);
v := BAND(BSL(v, 1), $FF);
end;
end;
asm -wb "{active}"
(evaluate "{active}" =~ /(?*):(?*)¿1.a/ )> dev:null
(evaluate "{active}" =~ "/(?*)¿2.a/" )> dev:null
link -sn CalcCRC="{¿1}" "{active}.o" -o "{¿2}"
dumpcode "{¿2}"